IOMMU/PCI: don't let domain cleanup continue when device de-assignment failed
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:33:35 +0000 (09:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:33:35 +0000 (09:33 +0200)
commit645fcf8a96d706b6037b7a772557213479be9a06
treee01cc1ecfa5b6c8704630df50bb8cc8b577eba15
parent86c223c9818d23b92f84494389e5b76c7fc0ad29
IOMMU/PCI: don't let domain cleanup continue when device de-assignment failed

Failure here could in principle mean the device may still be issuing DMA
requests, which would continue to be translated by the page tables the
device entry currently points at. With this we cannot allow the
subsequent cleanup step of freeing the page tables to occur, to prevent
use-after-free issues. We would need to accept, for the time being, that
in such a case the remaining domain resources will all be leaked, and
the domain will continue to exist as a zombie.

However, with flushes no longer timing out (and with proper timeout
detection for device I/O TLB flushing yet to be implemented), there's no
way anymore for failures to occur, except due to bugs elsewhere. Hence
the change here is merely a "just in case" one.

In order to continue the loop in spite of an error, we can't use
pci_get_pdev_by_domain() anymore. I have no idea why it was used here in
the first place, instead of the cheaper list iteration.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
master commit: f591755823a7e94fc6b4b8ddce71f0421a94fa09
master date: 2021-06-25 14:06:55 +0200
xen/drivers/passthrough/pci.c